package examples;
import java.util.*;
import search.*;
/**
 * Write a description of class TowerStateSpace here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class TowerStateSpace extends Digraph<TowerState, ChooseBlock>
{
    public TowerStateSpace(Tower tower)
    {
        addNode(new TowerState(tower));
    }
    
    public List<ChooseBlock> getEdges(TowerState ts)
    {
        Tower t = ts.getData();
        ArrayList<Integer> remaining = t.getRemaining();
        ArrayList<ChooseBlock> list = new ArrayList<ChooseBlock>();
        for (int n : remaining) {
            ChooseBlock cb = new ChooseBlock(ts, new TowerState(t.choose(n)), n);
            list.add(cb);
            addEdge(cb);
        }
        return list;
    }
    
    public void associateEdgeWithNode(ChooseBlock cb, TowerState ts)
    {
        //nothing to do - cb already computable from ts
    }
}
